package com.hmy.cornpestdet.controller;

import com.hmy.cornpestdet.service.UserMapService;
import com.hmy.cornpestdet.utils.Result;
import com.hmy.cornpestdet.vo.CircleAreaVo;
import com.hmy.cornpestdet.vo.MarkerPointVo;
import com.hmy.cornpestdet.vo.PolygonAreaVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/map")
public class UserMapController {
    @Autowired
    private UserMapService userMapService;

    //标记点操作
    @GetMapping("/getAllMarkerPointByUid")
    public Result getAllMarkerPointByUid() {
        return userMapService.getAllMarkerPointByUid();
    }
    @PostMapping("/deleteMarkerPointByPid")
    public Result deleteMarkerPointByPid(@RequestParam String pid){
        return userMapService.deleteMarkerPointByPid(pid);
    }
    @PostMapping("/addMarkerPoint")
    public Result addMarkerPoint(@RequestBody MarkerPointVo markerPointVo){
        return userMapService.addMarkerPoint(markerPointVo);
    }
    //圆形区域操作
    @GetMapping("/getCircleArea")
    public Result getCircleArea(){
        return userMapService.getCircleArea();
    }
    @PostMapping("/addCircleArea")
    public Result addCircleArea(@RequestBody CircleAreaVo circleAreaVo){
        return userMapService.addCircleArea(circleAreaVo);
    }
    @PostMapping("/deleteCircleArea")
    public Result deleteCircleArea(){
        return userMapService.deleteCircleArea();
    }
    //多边形区域
    @GetMapping("/getPolygonArea")
    public Result getPolygonArea(){
        return userMapService.getPolygonArea();
    }
    @PostMapping("/addPolygonArea")
    public Result addPolygonArea(@RequestBody PolygonAreaVo polygonAreaVo){
        return userMapService.addPolygonArea(polygonAreaVo);
    }
    @PostMapping("/deletePolygonArea")
    public Result deletePolygonArea(){
        return userMapService.deletePolygonArea();
    }
    //更新用户信息
    @PostMapping("/updateUserProvince")
    public Result updateUserProvince(@RequestParam String province){
        return userMapService.updateUserProvince(province);
    }

    @GetMapping("/getUserPointWindowInfoByPid")
    public Result getUserPointWindowInfoByPid(@RequestParam String pid){
        return userMapService.getUserPointWindowInfoByPid(pid);
    }

    @PostMapping("/updateUserPointWindowInfoByPid")
    public Result updateUserPointWindowInfoByPid(@RequestParam String pid, @RequestParam String info){
        return userMapService.updateUserPointWindowInfoByPid(pid, info);
    }

    //获取水稻种植区形参的矩形区域
    @GetMapping("/getRiceReactArea")
    public Result getRiceReactArea(){
        return userMapService.getRiceReactArea();
    }
}
